package demo4;

public class Test {
    public static void walk(IsRun isRun){
        isRun.run();
    }

    public static void swim(IsSwim isSwim){
        isSwim.swim();
    }

    public static void fun(Animals animals){
        animals.eat();
    }

    public static void main(String[] args) {
        Dog dog= new Dog("bit",20);
        Duck duck = new Duck("feifei", 30);
        walk(dog);
        walk(duck);
        swim(dog);
        swim(duck);

    }

    public static void main1(String[] args) {
        Animals animals1 = new Dog("bit",20);
        Animals animals2 = new Duck("feifei", 30);
        fun(animals1);
        fun(animals2);
    }
}
